package com.hctforgreen.greenservice;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;

import com.hctforgreen.greenservice.utils.ScreenUtil;
import com.hctforgreen.greenservice.utils.ThemeStoreUtil;
/**
 * 二维码下载页(软件设置页内)
 * @author Tallen Zhai
 *
 */
public class QrcodeDownloadActivity extends ParentActivity{
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_qrcode_download);
		initSkinLayout();
		initTitleButtonBar();
		initWindow();
	}

	private void initTitleButtonBar() {
		final TextView titleTv = (TextView) findViewById(R.id.tv_title);
		titleTv.setText(getString(R.string.qrcode_download_hint));

		final ImageButton backBtn = (ImageButton) findViewById(R.id.btn_back);
		backBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});
	}

	private void initWindow() {
		
		dealTopBannerParams();
	}
	/**
	 * 按原图比例缩放顶部Banner
	 */
	private void dealTopBannerParams() {
		ScreenUtil screenUtil = new ScreenUtil();
		int screenWidth = screenUtil.getScreenWidth(QrcodeDownloadActivity.this);

		int topBannerHeight = (screenWidth * 330 / 640);

		ImageView topBannerIv = (ImageView)findViewById(R.id.iv_qrcode_banner);
		LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT,
				topBannerHeight);
		topBannerIv.setLayoutParams(params);
	}
}
